Bashcomp: add missing options, add --vcs completion
authorgentoo90 <gentoo90@gmail.com>
Sun, 26 Jul 2015 10:59:57 +0000 (13:59 +0300)
committergentoo90 <gentoo90@gmail.com>
Sun, 26 Jul 2015 10:59:57 +0000 (13:59 +0300)
src/etc/cargo.bashcomp.sh

index 1b036e5ae57137b6d214323cc8144a8240a2c5f2..d3a1649a8728bdc701a8189e591acd6a5b37ecfe 100644 (file)
@@ -9,8 +9,12 @@ _cargo()
        cmd=${words[1]}
 
        local commands=$(cargo --list | tail -n +2)
+       local vcs='git hg none'
 
-       local opt_common='-h --help -v --verbose'
+       local opt_help='-h --help'
+       local opt_verbose='-v --verbose'
+       local opt_quiet='-q --quiet'
+       local opt_common="$opt_help $opt_verbose $opt_quiet"
        local opt_pkg='-p --package'
        local opt_feat='--features --no-default-features'
        local opt_mani='--manifest-path'
@@ -30,7 +34,7 @@ _cargo()
        local opt__owner="$opt_common -a --add -r --remove -l --list --index --token"
        local opt__pkgid="${opt__fetch}"
        local opt__publish="$opt_common $opt_mani --host --token --no-verify"
-       local opt__read_manifest="${opt__fetch}"
+       local opt__read_manifest="$opt_help $opt_verbose $opt_mani"
        local opt__run="$opt_common $opt_feat $opt_mani $opt_jobs --target --bin --example --release"
        local opt__rustc="$opt_common $opt_pkg $opt_feat $opt_mani $opt_jobs --target --lib --bin --test --bench --example --release"
        local opt__search="$opt_common --host"
@@ -38,7 +42,7 @@ _cargo()
        local opt__update="$opt_common $opt_pkg $opt_mani --aggressive --precise"
        local opt__package="$opt_common $opt_mani -l --list --no-verify --no-metadata"
        local opt__verify_project="${opt__fetch}"
-       local opt__version="$opt_common"
+       local opt__version="$opt_help $opt_verbose"
        local opt__yank="$opt_common --vers --undo --index --token"
 
        if [[ $cword -eq 1 ]]; then
@@ -49,6 +53,9 @@ _cargo()
                fi
        elif [[ $cword -ge 2 ]]; then
                case "${prev}" in
+                       --vcs)
+                               COMPREPLY=( $( compgen -W "$vcs" -- "$cur" ) )
+                               ;;
                        --manifest-path)
                                _filedir toml
                                ;;